package org.csmzxy.class233;

public class Example02 {
    public static void main(String[] args) throws InterruptedException{
        //创建1个自定义线程任务对象
        MyRunnable01 mr = new MyRunnable01();
        //创建两个线程对象
        Thread t1 = new Thread(mr,"线程1");
        Thread t2 = new Thread(mr,"线程2");
        //启动线程
        t1.start();
        t2.start();
        //在主方法中执行while循环
        while (true) {
            System.out.println("main()方法在运行");
            //让当前线程暂停1000毫秒
            Thread.sleep(1000);
        }
    }
}
